Skip to content

fix(static): preserve matched handler 404s#3043

Merged
aldas merged 2 commits into
labstack:masterfrom
JSap0914:fix/2775-preserve-matched-handler-not-found
Jul 16, 2026
Merged

fix(static): preserve matched handler 404s#3043
aldas merged 2 commits into
labstack:masterfrom
JSap0914:fix/2775-preserve-matched-handler-not-found

Conversation

@JSap0914

@JSap0914 JSap0914 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Fixes #2775

Preserves 404 responses from matched handlers when HTML5 static fallback is enabled, while retaining the index fallback for router misses, including group route-not-found handling.

Verification:

  • go test -race ./middleware -run '^TestStaticHTML5PreservesMatchedHandlerNotFound$' -count=1
  • go test -race ./middleware -run '^TestStatic$/^ok,_when_html5_mode_serve_index_for_any_static_file_that_does_not_exist$' -count=1
  • go test -race ./middleware

Comment thread middleware/static_test.go
@JSap0914

Copy link
Copy Markdown
Contributor Author

Refactored the two test cases into a table-driven test in middleware/static_test.go as requested. go test ./middleware/ -run TestStatic passes.

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.42%. Comparing base (01b45be) to head (f7971fa).
⚠️ Report is 33 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3043      +/-   ##
==========================================
+ Coverage   93.17%   93.42%   +0.24%     
==========================================
  Files          43       43              
  Lines        4501     4732     +231     
==========================================
+ Hits         4194     4421     +227     
- Misses        189      190       +1     
- Partials      118      121       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aldas
aldas merged commit 2caa1a5 into labstack:master Jul 16, 2026
10 checks passed
@aldas

aldas commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not found error conflict with StaticWithConfig middleware

2 participants